package org.hawk.gwt.ppc.scanner.utils;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

import org.hawk.gwt.ppc.utils.Name;

/**
 * Represents java constructor declaration scope.
 * @author alex.bereznevatiy@gmail.com
 */
public class JavaConstructor extends JavaMethod {
	private List<String> parameters;

	JavaConstructor(String className, JavaScope parent, int start,
			List<JavaVariable> vars) {
		super(Name.getSimpleName(className), 
				parent, start, vars, className);
		parameters = new LinkedList<String>();
	}

	@Override
	void endScope(int end) {
		super.endScope(end);
		parameters = Collections.unmodifiableList(parameters);
	}
	
	void addParameter(String param) {
		parameters.add(resolveType(param));
	}

	@Override
	public String[] getParametersTypes() {
		return parameters.toArray(
			new String[parameters.size()]);
	}
}
